import { AGConnectFunction, FunctionCallable } from '../../../../types'
import { FunctionCallableImpl } from './FunctionCallableImpl'
import { DEFAULT_CATEGORY } from "@hw-agconnect/api-ohos";

export class AGConnectFunctionImpl implements AGConnectFunction {
  private readonly identifier: string;
  private emulatorUrl: string;

  constructor(identifier?: string) {
    this.identifier = identifier ? identifier : DEFAULT_CATEGORY;
  }

  wrap(httpTriggerURI: string): FunctionCallable {
    return new FunctionCallableImpl(this.identifier, httpTriggerURI);
  }

  useEmulator(emulatorUrl: string): void {
    this.emulatorUrl = emulatorUrl;
  }

  getEmulatorUrl(): string {
    return this.emulatorUrl;
  }
}
